<?php

class Library {
	function arr2obj($arg_array) {
    	$tmp = new stdClass;//start with a new empty object
    	foreach ($arg_array as $key => $value) {
        	if (is_array($value)) {//check for array
            	$tmp->$key = $this->arr2obj($value);
        	} else {
            	if (is_numeric($key)) {//object keys cant begin with numeric values
                	die("Sorry, you can't turn numeric arrays into objects.");
            	}
            	$tmp->$key = $value;
        	}
    	}
    	return $tmp;//return the object
	}
}

?>